#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch) && ch != EOF) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2e6 + 10;

int n, m;
int f[N << 1][4][4];
bool ban[5][N];

int main() {
	scanf("%d %d", &n, &m);
	rep(i, 1, m) {
		int x, y;
		scanf("%d %d", &x, &y); 
		ban[x][y] = true;
	} memset(f, 0xcf, sizeof f);
	rep(i, 0, 4) ban[i][n + 1] = ban[i][n + 2] = ban[i][n + 3] = true;
	f[0][0][0] = 1; 
	rep(i, 1, n + 1) {
		rep(j, 0, 2) {
			rep(k, 0, 2)
				if(f[i - 1][j][k] >= 0) {
					rep(d, 0, 1) {
						rep(e, 0, 1) {
							int ax = j + d, bx = k + e;
							if(ax > 2 || bx > 2) continue;
							if(!ban[ax + 1][i - ax + 1] && !ban[bx + 1][i - bx + 1]) f[i][ax][bx] = max(f[i][ax][bx], f[i - 1][j][k] + (ax != bx) + 1);
						}
					}
				}
		}
	} cerr << f[n + 1][2][2] << endl;
	puts(f[n + 1][2][2] >= (2 * n) ? "YES" : "NO"); return 0;
}
